package com.dmitriyp.movie.console.actions;

import static java.lang.System.out;

import com.dmitriyp.movie.console.AbstractUserAction;
import com.dmitriyp.movie.console.UserInputUtil;
import com.dmitriyp.movie.dao.IMovieManager;

public class UserDeleteAction extends AbstractUserAction {

    public UserDeleteAction(IMovieManager manager) {
        super(manager);
    }

    public void doAction() {
        out.println("Enter Movie Id");
        int id = UserInputUtil.readInt(scanner);
        if(getManager().delete(id))
            out.println("Movie with Id {" + id +"} was deleted");
        else
            out.println("Movie with Id {" + id + "} was not found");
        UserInputUtil.pressAnyKey();
    }

}
